/*
 * Course:    CS 590 Web Services
 * Semseter:  Spring 2009
 * Professor: Sedlemeyer
 * Project:   CHEAT (Code Help Educational Assignment Tool)
 * Due Date:  May 1, 2009
 * Team:      Sarcasm
 *            (Baker, Jason; Mitchell, Robin; Shie, Keith)
 */

package cheat.entities.keys;

import cheat.entities.AssignmentExternalUrl;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * Holds the composite primary key for the {@linkplain AssignmentExternalUrl} entity.
 *
 * @author Keith Shie
 */
@Embeddable
public class AssignmentExternalUrlPK implements Serializable {
  @Basic(optional = false)
  @Column(name = "uuid", nullable = false)
  private int uuid;
  @Basic(optional = false)
  @Column(name = "url_id", nullable = false)
  private int urlId;

  public AssignmentExternalUrlPK() {
  }

  public AssignmentExternalUrlPK(int uuid, int urlId) {
    this.uuid = uuid;
    this.urlId = urlId;
  }

  public int getUuid() {
    return uuid;
  }

  public void setUuid(int uuid) {
    this.uuid = uuid;
  }

  public int getUrlId() {
    return urlId;
  }

  public void setUrlId(int urlId) {
    this.urlId = urlId;
  }

  @Override
  public int hashCode() {
    int hash = 0;
    hash += (int) uuid;
    hash += (int) urlId;
    return hash;
  }

  @Override
  public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof AssignmentExternalUrlPK)) {
      return false;
    }
    AssignmentExternalUrlPK other = (AssignmentExternalUrlPK) object;
    if (this.uuid != other.uuid) {
      return false;
    }
    if (this.urlId != other.urlId) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "cheat.entities.AsgnExtUrlPK[uuid=" + uuid + ", urlId=" + urlId + "]";
  }

}
